package com.wpq.game_company.service.impl;

import com.wpq.game_company.domain.Company;
import com.wpq.game_company.domain.User;
import com.wpq.game_company.mapper.UserMapper;
import com.wpq.game_company.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

//自动生成userServiceImpl对象
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 前端传来命令，调用实现类中的reg方法
     * userMapper.insert就调用了mapper接口中的UserMapper中的insert方法
     * 然后调用修改数据库，实现注册
     **/
    @Override
    public void reg(User user) {

        userMapper.insert(user);
    }

    @Override
    public User login(String username, String password){

        User findUsername=userMapper.findUsername(username);

            return findUsername;

    }

    @Override
    public Integer remove(String username) {
        return userMapper.remove(username);
    }


}
